import torch
import torchvision
from torch import nn
from torch.nn import ReLU, Sigmoid
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter

dataset = torchvision.datasets.CIFAR10('./dataset', train=False, download=True,
                                       transform=torchvision.transforms.ToTensor())
dataload = DataLoader(dataset, batch_size=64)
writer = SummaryWriter('relu_logs')
step = 0

class Con_module(nn.Module):
    def __init__(self):
        super(Con_module, self).__init__()
        self.relu1 = ReLU()
        self.sigmoid1 = Sigmoid()

    def forward(self, input):
        output = self.sigmoid1(input)
        return output

moduel = Con_module()

for data in dataload:
    imgs, target = data
    writer.add_images('input', imgs, step)
    output = moduel(imgs)
    writer.add_images('output', output, step)
    step += 1

writer.close()



